# 连续滑动解锁
# 1. 导包
from appium.webdriver.common.touch_action import TouchAction
from time import sleep
from my_money_cap import driver
from appium.webdriver.common.appiumby import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# 2. 定位,press()构造按压，加上x,y坐标，wait()设置等待时间，release()放开,perform()执行
try:
    menu_loc = driver.find_element(By.ID,'com.mymoney:id/switch_suite_btn')
except Exception as e:
    print('未能定位到此元素')

else:
    print('此元素被定位到了')
# # 显式等待
# WebDriverWait(driver, 30, 0.5).until(EC.visibility_of_element_located(menu_loc))
# # 实例化一个TouchAction对象
t_a = TouchAction(driver)
# 3. 输入坐标
t_a.press(x=220, y=380).wait(1000).move_to(x=490, y=380).wait(1000).move_to(x=490, y=650).wait(
    1000).release().perform()
sleep(3)

driver.quit()
